package easy.id_801_900;

import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

public class Lee804 {
    public static void main(String[] args) {
        String[] words = {"gin", "zen", "gig", "msg"};
        System.out.println(uniqueMorseRepresentations(words));


    }

    public static int uniqueMorseRepresentations(String[] words) {
        String[] MORSE = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.",
                "....", "..", ".---", "-.-", ".-..", "--", "-.",
                "---", ".--.", "--.-", ".-.", "...", "-", "..-",
                "...-", ".--", "-..-", "-.--", "--.."};
        Set<String> set=new LinkedHashSet<>();
        for(String item : words){
            StringBuilder code = new StringBuilder();
            for(int i=0;i<item.length();i++){
                char c = item.charAt(i);
                code.append(MORSE[c-'a']);
            }
            set.add(code.toString());
        }
        return set.size();
    }
}
